﻿/****************************** Module Header ******************************\
 * Module Name:  PageBasic.cs
 * Module Version:  1.0.0 (2011-12-15)
 * Copyright (c) AnyEB.Com (14507247@qq.com)
 * 
 * This class is a basic class for the webpage.  It supplies common public
 * methods to process a internet request, such as Request processing and so on. 
 * 
 * This source is subject to the GPL License.
 * See http://www.gnu.org/licenses/gpl.html.
 * All other rights reserved.
 * 
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace UCF.Core.Web.Demo
{
    /// <summary>
    /// 演示实例页面基类
    /// </summary>
    public class DemoWebPageBase : WebPageBase
    {
        #region 类属性-登录凭证

        /// <summary>
        /// 已登录的用户编号
        /// </summary>
        public Guid UserID;

        /// <summary>
        /// 已登录的用户名称
        /// </summary>
        public string UserName;

        /// <summary>
        /// 是否是管理员
        /// </summary>
        public bool IsAdmin;

        /// <summary>
        /// 前台管理员编号
        /// </summary>
        public Guid AdminID;

        /// <summary>
        /// 前台管理员名称
        /// </summary>
        public string AdminName = "system";

        /// <summary>
        /// 域名标签
        /// </summary>
        public string SiteTag;

        #endregion

        #region 构造方法
        /// <summary>
        /// 默认构造方法
        /// </summary>
        public DemoWebPageBase() { }

        /// <summary>
        /// 带数据连接名称的构造方法
        /// </summary>
        /// <param name="connectionName">数据连接名称</param>
        public DemoWebPageBase(string connectionName)
            : base(connectionName)
        {

        }

        #endregion


        /// <summary>
        /// 检测是否有页面消息,如果并回退浏览器
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public virtual bool CheckPageMessage(Page page)
        {
            return this.CheckPageMessage(page, "");
        }
        /// <summary>
        /// 检测是否有页面消息
        /// </summary>
        /// <param name="page"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public virtual bool CheckPageMessage(Page page, string url)
        {
            bool blnOut = true;
            if (this.PageMessage.Count > 0)
            {
                MessageBox.Show(page, this.PageMessage.Values.ToString("<br />"), "提示", url);
                blnOut = false;
            }
            return blnOut;
        }
        
    }
}
